
import {useHistory,useStorage} from './hooks'

import { Button } from 'antd'

export function UseSyncExternalStoreDemo () {
 const [data,setStorage] = useStorage('storageKey',{name:'小鱼'})

 const [urlData,push,replace] = useHistory()

return (
    <>
    <h3>UseSyncExternalStore使用</h3>
    <div>
        缓存值：{JSON.stringify(data)}
    </div>
    <Button type='primary' onClick={()=>setStorage({name:'对不起，是我不够好'})}>改变</Button>
    
    <div>
        url: {urlData}
    </div>
    <Button type='primary' onClick={()=>push('/a')}>改变</Button>
    <Button type='primary' onClick={()=>replace('/b')}>改变</Button>

    </>
)    
}